package com.ll.daipao.web;

import com.alibaba.fastjson.JSONObject;
import com.ll.daipao.dto.Account;
import com.ll.daipao.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by ll on 2017/10/12.
 */
@Controller
@RequestMapping("order")
public class OrderMangerController {
    @Autowired
    OrderService orderService;

    @RequestMapping(value = "list", produces = "text/json;charset=UTF-8")
    @ResponseBody
    public String list(HttpServletRequest request){
        Map<String ,Object> map = new HashMap<String, Object>();
        JSONObject res = new JSONObject();
        List<Map<String, Object>> maps = orderService.selectAll(map);
        res.put("code",0);
        res.put("msg","成功");
        res.put("count",maps.size());
        res.put("data",maps);
        return res.toJSONString();
    }

}
